<?php if((isset($event) && $event['Event']['lat'] && $event['Event']['lng']) || (isset($events))) {?>
<?php 
	$region = '';
	if(cr('Geo.region'))
	{
		$region = 'region='.cr('Geo.region');
	}
	if(!isset($this->params['isAjax']) || !$this->params['isAjax']){?>
	<script type="text/javascript" src="<?php echo 'http://maps.google.com/maps/api/js?sensor=false&'.$region?>"></script>
	<script type="text/javascript" src="<?php echo $html->url("/js/geomap.js")?>"></script>
	<script type="text/javascript" src="<?php echo $html->url("/js/infobubble.js")?>"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo $html->url("/css/geomap.css")?>" />
<?php }?>
<?php
	$d = array('width' => "100%",'height'=>'310');
?>
<div id="map_view_wrapper" style="<?php echo 'width:'.$d['width'].'px;height:'.$d['height'].'px' ?>">
<div id="map_for_view" class="map_display" style="">
	
</div>
<?php 
if(isset($showStreetView) && $showStreetView){?>
<div id="street_view" class="map_display" style="">
	
</div>
<?php } ?>
</div>
<?php 
	if(isset($event))
	$makersJson = $geoMap->getEventsMarkerJson(array($event));
	if(isset($events))
	$makersJson = $geoMap->getEventsMarkerJson($events);
	
?>
<script>
	$(document).ready(function(){
		<?php if(isset($showStreetView) && $showStreetView){?>
			$('#map_for_view').addClass('unit').css({'width' : "100%",'height':'200px'});
			$('#street_view').addClass('unitExt').css({'width' : "100%",'height':'200px'});
		<?php }else{ ?>
			$('#map_for_view').addClass('unit').css({'width' : "100%",'height':'300px'});
		<?php } ?>
		var mapData = <?php echo $makersJson?>;
		var latLng = {lat:0,lng:0};
		if(latLng)
		{
			var latlng = new google.maps.LatLng( latLng.lat,latLng.lng);
			var mapOptions = {zoom: 5,center:latlng,mapTypeId: google.maps.MapTypeId.HYBRID};
            var Mapper = new GeoMapper();
			Mapper.makeMapAndMakers(document.getElementById('map_for_view'),mapOptions,mapData);
			var streetView = new google.maps.StreetViewPanorama(document.getElementById('street_view'),{position: new google.maps.LatLng( mapData[0].lat,mapData[0].lng) });
		}
	})
</script>
<?php } ?>